package com.inventory.api.entity;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.util.Date;

/**
 * Created by hanxi on 2017/7/8.
 */
@Slf4j
@Entity
@Data
@NoArgsConstructor
public class Product {
    @Id
    @Column(length = 50)
    private String id;

    private String storeId;

    private String name;


    /**
     * 仓库商品数量（单位个）
     */
    @Column(columnDefinition = "int(11) NOT NULL DEFAULT 0")
    private int warehouseQuantity = 0;
    @Column(insertable = false, updatable = false, columnDefinition = "TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3)")
    private Date addTime;
    @Column(insertable = false, updatable = false, columnDefinition = "TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)")
    private Date updateTime;


    public Product(String id, String storeId, String name, int warehouseQuantity) {
        this.id = id;
        this.storeId = storeId;
        this.name = name;
        this.warehouseQuantity = warehouseQuantity;
    }
}
